#include "NetcdfNcReader.h"
#include "NetcdfDataReader.h"

using namespace OCPP;

NetcdfNcReader::NetcdfNcReader()
{

}

NetcdfNcReader::~NetcdfNcReader()
{
	close();
}

void NetcdfNcReader::close()
{
	if (ncWrapper != nullptr) {
		ncWrapper->close();
	}
	ncWrapper = nullptr;
}

bool NetcdfNcReader::open(String fileName)
{
	ncWrapper = std::make_shared<NcWrapper>();
	return ncWrapper->open(fileName);
}

GridVariablePtr NetcdfNcReader::findVariable(String name)
{
	return ncWrapper->findVariable(name);
}


GridDataReaderPtr NetcdfNcReader::getDataReader(GridShape origin, GridShape shape, GridVariablePtr variable)
{
	return std::make_shared<NetcdfDataReader>(origin, shape, variable);
}


